{% extends 'admin/index.html' %}
{% load crispy_forms_tags settings_tags app_tags %}


{% block content %}

{% is_demo as DEMO_MODE %}

<h1 class="h1 m-3"><i class="fa fa-gear fa-fw"></i> {{ settings_wrapper.title }}</h1>

<div class="row bg-white p-5">
	<div class="col-5 col-sm-3">
		<div class="nav flex-column nav-tabs h-100" id="vert-tabs-tab" role="tablist" aria-orientation="vertical">
			{% for name, _ in settings_wrapper.tabs.items  %}

				<a class="nav-link {% if forloop.first %} active {% endif %}" id="vert-tabs-{{ name|slugify }}-tab" data-toggle="pill" href="#vert-tabs-{{ name|slugify }}" role="tab" aria-controls="vert-tabs-{{ name|slugify }}" aria-selected="true">{{ name }}</a>

			{% endfor %}
		</div>
	</div>
	<div class="col-7 col-sm-9">
		<div class="tab-content" id="vert-tabs-tabContent">
			{% for name, form in settings_wrapper.tabs.items  %}
				<div class="tab-pane text-left fade {% if forloop.first %} active show {% endif %} p-3" id="vert-tabs-{{ name|slugify }}" role="tabpanel" aria-labelledby="vert-tabs-{{ name|slugify }}-tab">
					{% if DEMO_MODE and 'SMTP' in name %}
						{% include 'tpls/demo_mode_message.html' %}
					{% else %}
						<form method='POST' {{ form.enctype }}>
							{% csrf_token %}
							{{ form|crispy }}
							<input type="hidden" name="section" value="{{ name|slugify }}">
							<button type="submit" class="btn btn-primary">Save Settings</button>
						</form>
					{% endif %}
				</div>
				{{ form.media }}
			{% endfor %}
		</div>
	</div>
</div>

{% endblock %}
